import { ApiProperty, IntersectionType, PartialType } from '@nestjs/swagger'
import {
  IsDate,
  IsNumber,
  IsOptional,
  IsString,
} from 'class-validator'
import { PagerDto } from '~/common/dto/pager.dto'

export class UserAlarmDto {
  @ApiProperty({ description: '用户ID' })
  @IsNumber()
  userId: number

  @ApiProperty({ description: '设备ID' })
  @IsString()
  uid: string

  @ApiProperty({ description: '告警类型' })
  @IsNumber()
  type: number

  @ApiProperty({ description: '告警内容' })
  @IsString()
  content: string

  @ApiProperty({ description: '状态' })
  @IsNumber()
  status: number

  @ApiProperty({ description: '开始时间' })
  @IsDate()
  @IsOptional()
  startAt?: Date

  @ApiProperty({ description: '结束时间' })
  @IsDate()
  @IsOptional()
  endAt?: Date

  @ApiProperty({ description: '部门ID' })
  @IsOptional()
  deptId?: number
}

export class UserAlarmUpdateDto extends PartialType(UserAlarmDto) {}

export class UserAlarmQueryDto extends IntersectionType(PagerDto, PartialType(UserAlarmDto)) {}
